package cn.easybuy.daoImpl;

import cn.easybuy.dao.OrderDao;
import cn.easybuy.entity.Order;
import cn.easybuy.utils.BaseDao;

public class OrderDaoImpl extends BaseDao implements OrderDao {

    @Override
    public int update(Order order) {
        String sql="UPDATE easybuy_order SET loginName=? where id=?";
        Object[] param={order.getLoginName(),order.getId()};
        int result=this.executeUpdate(sql,param);
        return result;
    }

    @Override
    public int del(Order order) {
        String sql="DELETE FROM easybuy_order WHERE id=?";
        Object[] param={order.getId()};
        int result=this.executeUpdate(sql,param);
        return result;
    }

    @Override
    public int add(Order order) {
        String sql="INSERT INTO easybuy_order (id,userId,loginName,userAddress,createTime,cost,serialNumber) VALUE (?,?,?,?,?,?,?)";
        Object[] param={order.getId(),order.getUserId(),order.getLoginName(),order.getUserAddress(),order.getCreateTime(),order.getCost(),order.getSerialNumber()};
        int result=this.executeUpdate(sql,param);
        return result;
    }
}
